<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Configure debug access</title>
<title>CMSIS-Pack: Configure debug access</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 46px;">
  <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMSIS-Pack
   &#160;<span id="projectnumber">Version 1.6.3</span>
   </div>
   <div id="projectbrief">Delivery Mechanism for Software Packs</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
    <ul class="tablist">
      <script type="text/javascript">
		<!--
		writeComponentTabs.call(this);
		//-->
      </script>
	  </ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dbg_setup_access.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Configure debug access </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Professional IDE debuggers provide great flexibility and multiple options for configuring debug of modern microcontrollers. But for software developers it is often challenging to correctly configure debug settings for their target system. Using <a class="el" href="debug_description.html#das_elements">debug description elements</a> chip vendors can specify debug parameters applicable to a particular device and provide the default settings to be used by the debugger tool.</p>
<p>This chapter explains how to use the debug description elements.</p>
<h1><a class="anchor" id="dbg_debug"></a>
Specify CPU debug connection</h1>
<p>An important item that needs to be specified for an MCU is the debug connection to the CPU. For that <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> element shall be used. This element is most commonly used in DFPs to specify the <a href="../../SVD/html/index.html"><b>system view description file (.svd)</b></a>. But it also contains useful attributes to define the debug connection to the processor: <b>__dp</b> , <b>__ap</b> and <b>Pname</b>.</p>
<p>An example code below defines debug connection for a dual-core device with one debug port and 2 access ports: indexed as <code>0</code> for Cortex-M4 and <code>1</code> for Cortex-M0+.</p>
<div class="fragment"><div class="line">&lt;devices&gt;</div>
<div class="line">  &lt;family Dfamily=<span class="stringliteral">&quot;LPC54114&quot;</span> Dvendor=<span class="stringliteral">&quot;NXP:11&quot;</span>&gt;    </div>
<div class="line">    ...</div>
<div class="line">    &lt;device Dname=<span class="stringliteral">&quot;LPC54114J256&quot;</span>&gt;</div>
<div class="line">      &lt;processor Pname=<span class="stringliteral">&quot;CM0plus&quot;</span> Dcore=<span class="stringliteral">&quot;Cortex-M0+&quot;</span> Dfpu=<span class="stringliteral">&quot;NO_FPU&quot;</span> Dmpu=<span class="stringliteral">&quot;NO_MPU&quot;</span> Dendian=<span class="stringliteral">&quot;Little-endian&quot;</span> Dclock=<span class="stringliteral">&quot;100000000&quot;</span>/&gt;</div>
<div class="line">      &lt;processor Pname=<span class="stringliteral">&quot;CM4&quot;</span> Dcore=<span class="stringliteral">&quot;Cortex-M4&quot;</span> Dfpu=<span class="stringliteral">&quot;SP_FPU&quot;</span> Dmpu=<span class="stringliteral">&quot;MPU&quot;</span> Dendian=<span class="stringliteral">&quot;Little-endian&quot;</span> Dclock=<span class="stringliteral">&quot;100000000&quot;</span>/&gt;</div>
<div class="line">      ...</div>
<div class="line">      &lt;debug svd=<span class="stringliteral">&quot;SVD/LPC54114_cm0plus.xml&quot;</span> Pname=<span class="stringliteral">&quot;CM0plus&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;1&quot;</span>/&gt;</div>
<div class="line">      &lt;debug svd=<span class="stringliteral">&quot;SVD/LPC54114_cm4.xml&quot;</span> Pname=<span class="stringliteral">&quot;CM4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
<div class="line">          ...</div>
<div class="line">    &lt;/device&gt;</div>
<div class="line">    ...</div>
<div class="line">  &lt;/family&gt;</div>
<div class="line">&lt;/devices&gt;</div>
</div><!-- fragment --><p>The same <b>Pname</b> identifier shall be used in <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> element as defined in the corresponding <a class="el" href="pdsc_family_pg.html#element_processor">processor</a> element ('CM0plus' or 'CM4' in this example).</p>
<p>The numeric index values shall be typically specified for <b>__dp</b> attribute when multiple debug ports are available in the system and defined via <a class="el" href="pdsc_family_pg.html#element_debugport">debugport</a> element. See <a class="el" href="dbg_setup_access.html#dbg_debug_port">Specify debug port</a> for details about configuring debug ports.</p>
<p>For the <b>__ap</b> attribute the numeric index values shall be assigned based on the debug system implementation.</p>
<p>There's no need to specify all attributes in a single line at once, it can also be split over multiple assignments if it helps to better structure the sequences code. However the same <b>Pname</b> identifier shall be used. So the code below specifies the same debug connection for M4 processor as in the example above:</p>
<div class="fragment"><div class="line">&lt;debug Pname=<span class="stringliteral">&quot;CM4&quot;</span> svd=<span class="stringliteral">&quot;SVD/LPC54114_cm4.xml&quot;</span>/&gt;</div>
<div class="line">...</div>
<div class="line">&lt;debug Pname=<span class="stringliteral">&quot;CM4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
<div class="line">...</div>
</div><!-- fragment --><p>The attribute <a class="el" href="pdsc_family_pg.html#defaultResetSequence">defaultResetSequence</a> specifies the debug sequence that will be used by default to reset the device.</p>
<p>The debug IDE may also allow users to specify the reset type in the project options thus overwriting this default configuration. In multi-core systems <b>Pname</b> shall be used to ensure that the default reset sequence is set for a correct core.</p>
<div class="fragment"><div class="line">&lt;debug Pname=<span class="stringliteral">&quot;M4&quot;</span> defaultResetSequence=<span class="stringliteral">&quot;ResetProcessor&quot;</span>/&gt;</div>
</div><!-- fragment --><h1><a class="anchor" id="dbg_debug_port"></a>
Specify debug port</h1>
<p>A microcontroller system can have one or more CoreSight debug ports with one or more supported debug protocols (for example JTAG and SWD). <a class="el" href="pdsc_family_pg.html#element_debugport">debugport</a> element can be used to describe the debug ports capabilities.</p>
<p>For example if only Arm Serial Wire Debug (SWD) interface is supported, then <b>debugport</b> shall be defined only with <a class="el" href="pdsc_family_pg.html#element_dp_swd">swd</a> child element and no <a class="el" href="pdsc_family_pg.html#element_dp_jtag">jtag</a> elements. The <b>swd</b> element is really simple and can only take an <b>idcode</b> attribute that needs to be explicitly provided when you want to override the value of the SWD debug port's DPIDR register that will be read from the device.</p>
<div class="fragment"><div class="line">...</div>
<div class="line">  &lt;debugport __dp=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
<div class="line">    &lt;swd/&gt;</div>
<div class="line">  &lt;/debugport&gt;</div>
<div class="line">...</div>
</div><!-- fragment --><p>Vice versa is true as well, if only JTAG is supported then SWD shall not be listed in the <b>debugport</b> element.</p>
<p>The numeric value assinged to the <b>__dp</b> identifies the debug port and is for the user to choose. When describing JTAG chains it is recommended to use the <b>tapindex</b> as the <b>__dp</b> value to avoid confusion.</p>
<p>Debuggers can normally autodetect JTAG chains. But with some devices there is still a need to fully specify the JTAG chain to avoid potential detection issues by the debugger. Below is an example for the NXP IMX6 Solo X:</p>
<div class="fragment"><div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;0&quot;</span>&gt;</div>
<div class="line">  &lt;jtag tapindex=<span class="stringliteral">&quot;0&quot;</span> idcode=<span class="stringliteral">&quot;0x4BA00477&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
<div class="line">&lt;/debugport&gt;</div>
<div class="line">  </div>
<div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;1&quot;</span>&gt;</div>
<div class="line">  &lt;jtag tapindex=<span class="stringliteral">&quot;1&quot;</span> idcode=<span class="stringliteral">&quot;0x4BA00477&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
<div class="line">&lt;/debugport&gt;</div>
<div class="line">   </div>
<div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;2&quot;</span>&gt;</div>
<div class="line">  &lt;jtag tapindex=<span class="stringliteral">&quot;2&quot;</span> idcode=<span class="stringliteral">&quot;0x00000000&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
<div class="line">&lt;/debugport&gt;</div>
<div class="line">  </div>
<div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;3&quot;</span>&gt;</div>
<div class="line">  &lt;jtag tapindex=<span class="stringliteral">&quot;3&quot;</span> idcode=<span class="stringliteral">&quot;0x0891C01D&quot;</span> irlen=<span class="stringliteral">&quot;5&quot;</span>/&gt;</div>
<div class="line">&lt;/debugport&gt;</div>
<div class="line">  </div>
<div class="line">&lt;debug Pname=<span class="stringliteral">&quot;Cortex-A9&quot;</span> __dp=<span class="stringliteral">&quot;1&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
<div class="line">&lt;debug Pname=<span class="stringliteral">&quot;Cortex-M4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
</div><!-- fragment --><p>Even though only two debug ports are used to access the processor cores, the other debug ports available in the system are specified as well. In this case it is needed to provide debugger with correct <b>irlen</b> values thus allowing it to correctly scan the JTAG chain and access the processors.</p>
<p>The <b>tapindex</b> uniquely identifies the JTAG interface and typically its value is also used as the identifier for the debug port (<b>__dp</b>) index. Same as with the SWD the explicit specification of the <b>idcode</b> attribute is really necessary only when it needs to overwrite the IDCODe value read from the device. And <b>irlen</b> attribute may require explicit specification here if there're problems correctly obtaining its value from the device.</p>
<h1><a class="anchor" id="dbg_debug_settings"></a>
Default debugger configuration</h1>
<p>To simplify the debugger configuration in an IDE the <a class="el" href="pdsc_family_pg.html#element_debugconfig">debugconfig</a> element can be used to specify the default working debugger configuration that should be used as a starting point until the user explicitely makes project-specific changes.</p>
<p>For example the code below specifies SWD interface as default one with debug clock 5MHz. The debug port supports switching between SWD and JTAG debug protocols.</p>
<div class="fragment"><div class="line">&lt;devices&gt;</div>
<div class="line">  &lt;family Dfamily=<span class="stringliteral">&quot;LPC54000 Series&quot;</span> Dvendor=<span class="stringliteral">&quot;NXP:11&quot;</span>&gt;</div>
<div class="line">    &lt;debugconfig <span class="keywordflow">default</span>=<span class="stringliteral">&quot;swd&quot;</span> clock=<span class="stringliteral">&quot;5000000&quot;</span> swj=<span class="stringliteral">&quot;true&quot;</span>/&gt;</div>
<div class="line">    ...</div>
<div class="line">  &lt;/family&gt;</div>
<div class="line">&lt;/devices&gt;</div>
</div><!-- fragment --><p>Using <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> it is also possible to specify the default reset type to be used. See <a class="el" href="dbg_setup_access.html#dbg_debug">Specify CPU debug connection</a> for details. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="coresight_setup.html">Debug Setup with CMSIS-Pack</a></li><li class="navelem"><a class="el" href="dbg_setup_tutorial.html">Debug Setup Tutorial</a></li>
    <li class="footer">Generated on Mon Feb 1 2021 16:48:06 for CMSIS-Pack Version 1.6.3 by Arm Ltd. All rights reserved.
	<!--
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 
	-->
	</li>
  </ul>
</div>
</body>
</html>
